# -*- coding: utf8 -*-
'''
    1.1.2 创建缩略图
'''

import os
from PIL import Image

infile = 'img/haizei.jpg'
outfile = os.path.splitext(infile)[0] + '1.1.2.jpg'
pil_im = Image.open(infile)
width = 180
ratio = float(width)/pil_im.size[0]
height = pil_im.size[1]*ratio
pil_im.thumbnail((width, height))
pil_im.save(outfile)
